home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / praf205e / ax25l2v2.doc next >
Text File  |  1995-04-01  |  69KB  |  1,502 lines

  1.  
  2.  
  3.                   AX.25 LAYER 2 PROTOCOL SPECIFICATION
  4.  
  5. This   protocol   conforms  with  the  ISO  Recommendations  3309,  4335 
  6. (including DAD 1&2) and 6256 high-level data  link  control  (HDLC)  and 
  7. uses some terminology found in these documents.
  8.  
  9. This  protocol also conforms with ANSI X3.66, describing ADCCP, balanced 
  10. mode.
  11.  
  12. This protocol is written  to  work  equally  well  in  either  half-  or 
  13. full-duplex amateur radio enviroments.
  14.  
  15. This  protocol  has  been  written  to  work  equally  well  for  either 
  16. point-to-point connections, or connections made thru  a  larger  device, 
  17. such as a metropolitan network controller (MNC).
  18.  
  19. This  protocol  does  allow  the  establishment of more than one layer 2 
  20. (link layer) connection per device, if the device is so capable.
  21.  
  22. This protocol also follows in principle the CCITT  X.25  recommendation, 
  23. with  the exception of an extended address field and the addition of the 
  24. Unnumbered Information (UI) frame.
  25.  
  26. Most layer 2 protocols assume that one large device (generally  called a 
  27. DCE,  or  data  circuit-terminating  equipment)  is connected to several 
  28. smaller devices (usually called a DTE, or data  terminating  equipment). 
  29. AX.25  assumes  that  both  ends  of  the  link  are  balanced,  thereby 
  30. eliminating the two different classes of device.
  31.  
  32.  
  33.  
  34. Frame_Structure
  35.  
  36. Level 2 packet-radio transmissions are  sent  in  small  blocks,  called 
  37. frames. These frames are made up of smaller parts, called fields. Fig. 1 
  38. shows how the three types of frames are made up. Fig. 1 shows the frames 
  39. in   the   same   bit   order  that  most  packet  articles  show  them. 
  40. Unfortunately,  this  method  has  led  to  some  confusion,  since  the 
  41. least-significant  bit (LSB) is to the left rather than to the right, as 
  42. most people would ordinarily assume.  I am pointing  this  out  early in 
  43. this  paper  to  prevent mass confusion as I progress.  Later on, I will 
  44. switch to a hopefully more understandable way of showing the  frame  ans 
  45. its components.
  46.  
  47.  
  48.  
  49. Field_Definitions
  50.  
  51. The  frame  is  made  up of several parts, called fields.  Each of these 
  52. fields is made up of an integral number of octets (or bytes), and serves 
  53. a specific function.
  54.  
  55.  
  56.  
  57. Flag_Field
  58.  
  59. Since  amateur  packet radio is a bit-oriented protocol, the only way to 
  60. tell when one frame is over and another  is  starting  for  sure  is  to 
  61. delimit each frame with a certain bit sequence both at the beginning and 
  62. the end.  This is the job of the flag field.  A flag consists  of a zero 
  63. followed by six ones followed by another zero, or 01111110 (7E hex). Due 
  64. to the bit stuffing mentioned above, the  only  time  this  sequence  is 
  65. allowed is at the beginning and end of a legitimate frame.
  66.  
  67.  
  68.  
  69. Address_Field
  70.  
  71. The address field is used to identify both where the frame came from and 
  72. what the destination of it is.  In the CCITT  recommendation  X.25, this 
  73. field is only one octet long. This permits at most 256 users per level 2 
  74. channel, and since some bits of this field were used for other purposes, 
  75. the real number of users were about thirty per level 2 channel. Both the 
  76. HDLC and ADCCP recommendations allowed the address field to be extended, 
  77. so  we  decided to extend the address field per their recommendations in 
  78. the amateur version of  X.25  to  include  the  callsigns  of  both  the 
  79. destination and source amateur radio stations. The method used to extend 
  80. the address field will be described shortly.
  81.  
  82.  
  83.  
  84. Control_Field
  85.  
  86. The control field is used to identify the  type  of  frame  and  control 
  87. several attributes of the level 2 connection. It is one octet in length, 
  88. and its encoding will be discussed in a following section.
  89.  
  90.  
  91.  
  92. PID-Field
  93.  
  94. The Protocol Identifier (PID) field is used only in information  frames, 
  95. and  identifies  what  kind of layer 3 protocol, if any, is in use.  Its 
  96. encoding is as follows:
  97.  
  98.      M      L
  99.      S      S
  100.      B      B
  101.      xx00xxxx  Reserved at the moment.
  102.      xx01yyyy  AX.25 layer 3 implemented.
  103.      xx10yyyy  AX.25 layer 3 implemented.
  104.      11110000  No layer 3 implemented.
  105.      11111111  Escape character.  Next byte contains more PID information.
  106.  
  107.             Where:
  108.  
  109.             1.   An x indicates a "don't care" bit.
  110.             2.   A y indicates all combinations used.
  111.  
  112.  
  113.  
  114. Information_Field
  115.  
  116. The information field is used to convey the actual user  data  from  one 
  117. end of the link to the other. I fields are allowed in only three tyes of 
  118. frames, the I frame, the UI frame, and the FRMR frame.  The I  field can 
  119. be up to 256 octets long, and should be an even multiple of octets long. 
  120. Any information in the I field should be passed along the  link  totally 
  121. transparently,  except  for  any zero-bit insertion necessary to prevent 
  122. flags from accidentally appearing in the I field.
  123.  
  124.  
  125.  
  126. Frame_Check_Sequence
  127.  
  128. The frame-check sequence is a sixteen-bit number calculated by both  the 
  129. sender  and receiver of a frame.  It is used to make sure that the frame 
  130. was not corrupted by the medium used to get the frame from the sender to 
  131. the  receiver.    It  is  calculated  in accordance with ISO 3309 (HDLC) 
  132. recommendations.
  133.  
  134.  
  135.  
  136. Bit_Stuffing
  137.  
  138. In order to assure  that  the  flag  sequence  mentioned  above  doesn't 
  139. accidentially  appear  anywhere  else  in a frame, as the frame is being 
  140. sent it should be monitored, and if more than five contiguous  ones  are 
  141. detected,  a  zero bit should be added between the fifth and sixth ones, 
  142. eliminating the possibility of a flag appearing in the frame other  than 
  143. where  it  belongs.    The  receiver of five ones, a zero, and more ones 
  144. should automatically eliminate the inserted zero before passing the data 
  145. on.
  146.  
  147.  
  148.  
  149. Bit_Order_of_Transmission
  150.  
  151. With  the exception of the FCS field, all other fields in an AX.25 frame 
  152. should be sent starting with the least-significant bit.    In accordance 
  153. with HDLC practices, the FCS should be sent most-significant bit first.
  154.  
  155.  
  156.  
  157. Frame_Abort
  158.  
  159. If a frame must be prematurely aborted, at least fifteen contiguous ones 
  160. should be sent with no bit stuffing added.
  161.  
  162.  
  163.  
  164. Invalid_Frames
  165.  
  166. Any frame consisting of less than 136 bits, or not  bounded  by  opening 
  167. and  closing  flags, or not octet aligned (an integral number of octets) 
  168. should be considered an invalid frame by the link layer.
  169.  
  170.  
  171.  
  172. Address_Field_Encoding
  173.  
  174. The address field  of  all  frames  should  be  encoded  with  both  the 
  175. destination  and  source  amateur  callsigns of the frame.  If a level 2 
  176. amateur "repeater" is to be used, its callsign should  also  be  in  the 
  177. address  field.   AX.25 follows the HDLC recommended method of extending 
  178. the address field in order to fit all this information into the  address 
  179. field.
  180.  
  181. Basically,  the  way the HDLC address field is extended beyond one octet 
  182. is to reserve the least-significant bit of each octet for what is called 
  183. an  "extender  bit".  This bit is set to zero if the next octet contains 
  184. more address field information, and is set to one if this  is  the  last 
  185. octet.   To make room for this extender bit, the amateur radio call sign 
  186. information is shifted  one  bit  to  the  left.    The  actual encoding 
  187. techniques for both non-repeater and repeater operation follows.
  188.  
  189.  
  190.  
  191. Non-Repeater_Address-Field_Encoding
  192.  
  193. If a level 2 repeater is not being used, the address field is encoded as 
  194. shown in Fig. 2. The destination address is the call sign of the amateur 
  195. radio  station  that the frame is addressed to, while the source address 
  196. contains the amateur call sign who sent the frame.  These call signs are 
  197. the  call signs of the two ends of a level 2 AX.25 link only, not of any 
  198. other station, such as  the  destination  of  a  packet  going  thru  an 
  199. intermediary  link.    Those  addresses should be in a higher layer, not 
  200. layer 2.
  201.  
  202. A1 thru A14 are the  fourteen  octets  that  make  up  the  two  address 
  203. sub-fields  of  the address field.  The destination sub-address is seven 
  204. octets long (A1 thru A7), and  is  sent  first.    This  will  allow the 
  205. receivers  of  the frame time to check the destination address sub-field 
  206. and see if the frame is for them while the rest of the  frame  is  being 
  207. received.    The source address sub-field is then sent in octets A8 thru 
  208. A14. Both of these sub-fields are encoded in the same manner, except for 
  209. the last octet having the HDLC address extender bit set.  Since they are 
  210. basically the same, only the destination sub-address will be outlined.
  211.  
  212. There is an extra octet at the end of each address sub-field that allows 
  213. room for a Secondary-Station Identifier (SSID) and three additional bits 
  214. for future expansion. The SSID field allows an Amateur Radio operator to 
  215. have more than one packet radio station.  This is useful when an amateur 
  216. wants to put up a repeater  in  addition  to  his  regular  station  for 
  217. example.
  218.  
  219. Appendix A shows a typical AX.25 frame in the non-repeater mode.
  220.  
  221.  
  222.  
  223. Destination Sub-Field Encoding
  224.  
  225. Fig.    3  shows  how  an amateur call sign is placed in the destination 
  226. address sub-field, occupying octets A1 thru A7.
  227.  
  228.      | Octet | ASCII |Bin.Data|Hex Data|
  229.      -----------------------------------
  230.      |  A1   |   W   |10101110|   AE   |
  231.      |  A2   |   B   |10000100|   84   |
  232.      |  A3   |   4   |01101000|   68   |
  233.      |  A4   |   J   |10010100|   94   |
  234.      |  A5   |   F   |10001100|   8C   |
  235.      |  A6   |   I   |10010010|   92   |
  236.      |  A7   | SSID  |0RRSSID0|        |
  237.      -----------------------------------
  238.      Bit Position-->  76543210
  239.  
  240.     Fig. 3.  Destination Field Encoding
  241.  
  242.         Where:
  243.  
  244.         1. The top octet (A1)  is  the  first  octet  sent 
  245.         (sort  of  like  popping  it  off  the  top of the 
  246.         stack), with bit 0 of each octet being  the  first 
  247.         bit sent, and bit 7 being the last bit sent.
  248.  
  249.         2.  The  first  (low  order  or bit 0) bit of each 
  250.         octet is the HDLC extender bit, which  is  set  to 
  251.         zero  on  all  but  the  last octet in the address 
  252.         field, where it is set to one.
  253.  
  254.         3. The bits marked "R" are reserved bits. They may 
  255.         be  used  in  an  agreed upon manner in individual 
  256.         networks.  If they aren't implemented, they should 
  257.         be set to one.
  258.  
  259.         4.  The  characters  of  the  callsign  should  be 
  260.         standard seven-bit ASCII (upper case only)  before 
  261.         being  shifted  left to make room for the extender 
  262.         bit.  If the callsign is less than  six characters 
  263.         long, it should be padded at the trailing end with 
  264.         ASCII spaces between the end of the  callsign  and 
  265.         the SSID octet.
  266.  
  267.         5.  The  SSID  portion  of the last octet has been 
  268.         intentionally left vague at  this  point,  and  is 
  269.         left  up to the individual station to assign.  The 
  270.         only recommended restriction  is  to  reserve  the 
  271.         all-one  condition  (1111) for an all-call SSID in 
  272.         case one wants to reach  an  amateur  but  doesn't 
  273.         know what SSID that amateur operates under.
  274.  
  275.  
  276.  
  277. Level_2_Repeater_Address-Field_Encoding
  278.  
  279. If a frame is to go thru a level 2 amateur packet repeater, there is  an 
  280. additional address sub-field added to the end of the address field. This 
  281. additional sub-field contains the call sign of the repeater to be  used. 
  282. This  will  allow  more  than one repeater to share the same rf channel, 
  283. which has been a problem with the older protocols. If this field exists, 
  284. the last octet of the source sub-field has its extender bit set to zero, 
  285. indicating that more address-field data follows.   The  repeater address 
  286. sub-field  is  encoded  in the same manner as the destination and source 
  287. address subfields, except for one bit in the last octet, called the  "H" 
  288. bit.  The H bit is used to indicate whether a frame has been repeated or 
  289. not. This is necessary to prevent someone from potentially receiving two 
  290. identical frames, the one going to the repeater, and the one coming back 
  291. from the repeater.  Fig.  4 shows how the repeater  address sub-field is 
  292. encoded.    Appendix B is an example of a complete frame on its way back 
  293. from a repeater.
  294.  
  295.      -----------------------------------
  296.      | Octet | ASCII |Bin.Data|Hex Data|
  297.      |---------------------------------|
  298.      |  A15  |   W   |10101110|   AE   |
  299.      |  A16  |   B   |10000100|   84   |
  300.      |  A17  |   4   |01101000|   68   |
  301.      |  A18  |   J   |10010100|   94   |
  302.      |  A19  |   F   |10001100|   8C   |
  303.      |  A20  |   I   |10010010|   92   |
  304.      |  A21  | SSID  |HRRSSID1|        |
  305.      -----------------------------------
  306.      Bit Order -->    76543210
  307.  
  308.     Fig 4.  Repeater Address Encoding
  309.  
  310.         Where:
  311.  
  312.         1. The top octet is the first octet sent, with bit 
  313.         0 being sent first, bit 7 sent last of each octet.
  314.  
  315.         2. As with  the  source  and  destination  address 
  316.         sub-fields  discussed above bit 0 of each octet is 
  317.         the HDLC address extender bit,  which  is  set  to 
  318.         zero on all but the last address octet (A21) where 
  319.         it is set to one.
  320.  
  321.         3. The "R" bits are  reserved  just  like  in  the 
  322.         source and destination sub-fields.
  323.  
  324.         4. The "H" bit is the has-been-repeated bit. It is 
  325.         set to zero on a non-repeated frame,  and  set  to 
  326.         one  by  the  repeater  when  the  frame  has been 
  327.         repeated.
  328.  
  329. It should be noted that some of the advantages of this addressing scheme 
  330. are mentioned in Appendix C.
  331.  
  332.  
  333.  
  334. Control_Field_Formats
  335.  
  336. The  control  field is responsible for identifying what type of frame is 
  337. being sent, and is also used to convey commands and responses  from  one 
  338. end of the link to the other to maintain proper control over the link.
  339.  
  340. The  control  fields used in AX.25 use the CCITT X.25 control fields for 
  341. balanced operation, with an additional control field taken from ADCCP to 
  342. allow connectionless and round-table operation.
  343.  
  344. There are three general types of AX.25 frames.  They are the Information 
  345. frame (I frame), the Supervisory frame (S  frame),  and  the  Unnumbered 
  346. frame  (U  frame).   Fig.  5 shows the basic format of the control field 
  347. associated with these types of frames.
  348.  
  349.      ----------------------------------------
  350.      |Control Field |    Control Field Bits |
  351.      |    Type      | 7 6 5 | 4 | 3 2  1  0 |
  352.      ----------------------------------------
  353.      |    I Frame   | N(R)  |P/F| N(S)  | 0 |
  354.      ----------------------------------------
  355.      |    S Frame   | N(R)  |P/F| S S| 0| 1 |
  356.      ----------------------------------------
  357.      |    U Frame   | M M M |P/F| M M| 1| 1 |
  358.      ----------------------------------------
  359.          Fig. 5.  Control Field Formats
  360.  
  361.         Where:
  362.  
  363.         1. Bit 0 is the first bit sent, bit 7 is the  last 
  364.         bit sent of the control field.
  365.  
  366.         2.  N(S) is the send sequence number (bit 2 is the 
  367.         LSB).
  368.  
  369.         3. N(R) is the receive sequence number (bit  6  is 
  370.         the LSB).
  371.  
  372.         4. The "S" bits are the supervisory function bits, 
  373.         and their encoding is discussed below.
  374.  
  375.         5. The "M" bits are the unnumbered frame  modifier 
  376.         bits and their encoding is discussed below.
  377.  
  378.         6. The P/F bit is the Poll/Final bit. Its function 
  379.         is described in more detail shortly.
  380.  
  381.  
  382.  
  383.  
  384. Control_Field_Definitions
  385.                                             
  386.  
  387.      Information Frame Control Field
  388.  
  389. All I frames have bit 0 of the control field set to zero.   N(S)  is the 
  390. sender's  send sequence number (the send sequence number of this frame). 
  391. N(R) is the sender's receive sequence number (the sequence number of the 
  392. next expected received frame. These numbers are described in the section 
  393. regarding flow control.
  394.  
  395.  
  396.      Supervisory Frame Control Field
  397.  
  398. Supervisory frames are denoted by having bit 0 of the control field  set 
  399. to  one,  and  bit 1 of the control field set to zero.  S frames provide 
  400. supervisory  link  control   such   as   acknowledging   or   requesting 
  401. retransmission  of  I  frames,  and  link level window control.  Since S 
  402. frames don't have an information field, the sender's send  variable  and 
  403. the receiver's receive variable are not incremented for S frames.
  404.  
  405.  
  406.     Unnumbered Frame Control Field
  407.  
  408. Unnumbered  frames  are distinguished by having both bits 0 and 1 set to 
  409. one.  U frames are responsible for  maintaining  control  over  the link 
  410. beyond what is accomplished with S frames. They are also responsible for 
  411. the establishment and tearing down of the link.  U frames also allow for 
  412. the transmission and reception of information outside of the normal flow 
  413. control. Some U frames may contain information fields.
  414.  
  415.  
  416.  
  417. Control_Field_Parameters
  418.  
  419.  
  420.      Sequence_Numbers_and_Variables
  421.  
  422. Every AX.25 I frame shall be assigned a sequential number from 0  to  7. 
  423. This  will allow up to seven outstanding I frames per level 2 connection 
  424. at a time.
  425.  
  426.  
  427.      Send_State_Variable_V(S)
  428.  
  429. The send state variable is an internal variable that is never sent.   It 
  430. contains  the  next  sequential  number  to  be  assigned  to  the  next 
  431. transmitted I frame.  This variable is updated upon the  transmission of 
  432. each I frame.
  433.  
  434.  
  435.      Send_Sequence_Number_N(S)
  436.  
  437. The  send sequence number is found in the control field of all I frames. 
  438. It contains the sequence number of the I frame being sent. Just prior to 
  439. the transmission of the I frame, N(S) is updated to equal the send state 
  440. state variable.
  441.  
  442.  
  443.      Receive_State_Variable_V(R)
  444.  
  445. The receive state variable is an internal  variable  that  contains  the 
  446. sequence number of the next expected received I frame.  This variable is 
  447. updated upon the reception of an error-free I frame whose send  sequence 
  448. number equals the present received state variable value.
  449.  
  450.  
  451.      Received_Sequence_Number_N(R)
  452.  
  453. The received sequence number is in both I and S frames. Prior to sending 
  454. an I or S frame, this variable is updated to equal that of the  received 
  455. state variable, thus implictly acknowledging the proper reception of all 
  456. I frames up to and including N(R)-1.
  457.  
  458.  
  459.      Poll/Final_(P/F)_Bit
  460.  
  461. The P/F bit may be used in all types of frames.  It is used in a command 
  462. (poll) mode to request an immediate reply to a frame.  The reply to this 
  463. poll is indicated by setting the response (final) bit in the appropriate 
  464. frame. Only one outstanding poll condition per direction is allowed at a 
  465. time.
  466.  
  467.  
  468.  
  469. Control_Field_Encoding
  470.  
  471.  
  472.      Information_Frame_Control_Field
  473.  
  474. The information frame control field is encoded as shown in Fig. 6. These 
  475. frames  are  sequentially  numbered to maintain control of their passage 
  476. over the link level connection.
  477.  
  478.                 Control Field Bits
  479.             -------------------------
  480.             | 7 6 5 | 4 | 3 2 1 | 0 |
  481.             -------------------------
  482.             | N(R)  |P/F|  N(S) | 0 |
  483.             -------------------------
  484.          Fig. 6.  I Frame Control Field
  485.                                                            
  486.  
  487.  
  488.      Supervisory_Frame_Control_Field
  489.  
  490. The supervisory frame control fields are encoded as shown in Fig.  7. In 
  491. AX.25, S frames are used only as responses to other frames.
  492.  
  493.  ------------------------------------------------
  494.  |  Control Field Bits  | 7 6 5 | 4 | 3 2 | 1 0 |
  495.  |----------------------------------------------|
  496.  |   Receive Ready  RR  | N(R)  |P/F| 0 0 | 0 1 |
  497.  |Receive Not Ready RNR | N(R)  |P/F| 0 1 | 0 1 |
  498.  |  Reject          REJ | N(R)  |P/F| 1 0 | 0 1 |
  499.  ------------------------------------------------
  500.         Fig. 7.  S frame control Fields
  501.  
  502.  
  503.  
  504.      Receive_Ready_(RR)_Response
  505.  
  506. Receive Ready is used to do the following:
  507.  
  508.         1. To indicate that the sender of the  RR  is  now 
  509.         able to recieve more I frames.
  510.  
  511.         2.  To  acknowledge  properly received I frames up 
  512.         to, and including N(R)-1.
  513.  
  514.         3.  To  clear  a  previously  set  busy  condition 
  515.         created by an RNR command having been sent.
  516.  
  517. It  should be noted that the status of the other side of the link can be 
  518. requested by setting the poll bit.
  519.                                                    
  520.         
  521.  
  522.      Receive_Not_Ready_(RNR)_Response
  523.  
  524. Receive not ready is used to indicate to the sender  of  I  frames  that 
  525. receiver is temporarily busy and cannot accept any more I frames. Frames 
  526. up to N(R)-1 are acknowledged.  Any I frames  numbered  N(R)  and higher 
  527. that might have been caught in between and not acknowledged when the RNR 
  528. command was sent are NOT acknowledged.
  529.  
  530. The RNR condition can be cleared by the sending of a  UA,  RR,  REJ,  or 
  531. SABM frame.  The P/F bit can be used within the RNR frame to interrogate 
  532. the status of the other side of the link.
  533.                                          
  534.  
  535.  
  536.      Reject_(REJ)_Response
  537.  
  538. The reject frame is used to request retransmission of I frames  starting 
  539. with N(R). Any frames that were sent with a sequence number of N(R)-1 or 
  540. less are acknowledged.  Additional  I  frames  may  be  appended  to the 
  541. retransmission of the N(R) frame if there are any.
  542.  
  543. Only  one reject frame condition is allowed in each direction at a time. 
  544. The reject condition is cleared by the proper reception of I  frames  up 
  545. to the I frame that caused the reject condition to be initiated.
  546.  
  547. As  with the other supervisory responses, the P/F bit may be used in the 
  548. REJ frame.
  549.           
  550.  
  551.      Unnumbered_Type_Frames
  552.  
  553. Unnumbered frame control fields are either commands or responses.   This 
  554. standard follows X.25 as much as possible.  The only deviation from X.25 
  555. is in the addition of the Unnumbered Information (UI) frame from  ADCCP. 
  556. X.25  is designed to work with in full-duplex systems with only one main 
  557. device (DCE) and potentially many users (DTEs).
  558.  
  559. Amateur Radio packet systems differ greatly on both of  these  respects. 
  560. Not  only  is  Amateur  Radio packet networking done in a half-duplex rf 
  561. environment, but many DCE/DTE links many be sharing  the  same  channel. 
  562. Many  amateurs  have  rejected  the  use  of  X.25  as a result of these 
  563. problems.  X.25 can easily be enhanced so that it will  perform properly 
  564. over amateur radio.
  565.  
  566. Fig. 8 shows the layout of U frames implemented within this standard.
  567.  
  568.  ------------------------------------------------
  569.  |   Control Field |Type|  Control Field Bits   |
  570.  |                  |   | 7 6 5   4   3 2   1 0 |
  571.  |----------------------------------------------|
  572.  |Set Asynchronous  |Cmd| 0 0 1 | P | 1 1 | 1 1 |
  573.  |Balanced Mode-SABM|   |       |   |     |     |
  574.  |----------------------------------------------|
  575.  | Disconnect-DISC  |Cmd| 0 1 0 | P | 0 0 | 1 1 |
  576.  |----------------------------------------------|
  577.  | Disconnected Mode|Res| 0 0 0 |P/F| 1 1 | 1 1 |
  578.  |       DM         |   |       |   |     |     |
  579.  |----------------------------------------------|
  580.  |   Unnumbered     |Res| 0 1 1 | F | 0 0 | 1 1 |
  581.  |  Acknowledge-UA  |   |       |   |     |     |
  582.  |----------------------------------------------|
  583.  | Frame Reject-FRMR|Res| 1 0 0 | F | 0 1 | 1 1 |
  584.  |----------------------------------------------|
  585.  |   Unnumbered     |Eit| 0 0 0 |P/F| 0 0 | 1 1 |
  586.  |  Information-UI  |her|       |   |     |     |
  587.  ------------------------------------------------
  588.         Fig. 8.  U Frame Control Fields
  589.  
  590.      Set_Asynchronous_Balanced_Mode_(SABM)_Command                   
  591.  
  592. The  SABM  command  is  used  to  place  2  stations in the asynchronous 
  593. balanced mode. This is a balanced mode of operation known as LAP B where 
  594. DCEs and DTEs are treated as equals.
  595.  
  596. Information  fields  aren't allowed in SABM commands.  Any outstanding I 
  597. frames left when the SABM command is issued will remain unacknowledged.
  598.                                                                        
  599.  
  600.      Disconnect_(DISC)_Command
  601.  
  602. The DISC command is  used  to  terminate  a  link  session  between  two 
  603. stations. No information field is permitted in a DISC command frame. Any 
  604. outstanding I frames will remain outstanding.
  605.                                              
  606.  
  607.      Disconnected_Mode_(DM)_Response
  608.  
  609. The disconnected mode response is sent whenever the DTE or DCE  receives 
  610. a  frame  other than a SABM while in a disconnected mode.  It is sent to 
  611. request a set mode command, or to indicate it cannot accept a connection 
  612. at the moment. The DM response cannot have an information field.
  613.  
  614. A  DCE or DTE in the disconnected mode will respond to any command other 
  615. than a SABM with a DM response with the P/F bit set to 1.
  616.                                                          
  617.  
  618.      Unnumbered_Acknowledge_(UA)_Response
  619.  
  620. The  UA  response  frame  is  sent  to  acknowledge  the  reception  and 
  621. acceptance  of  a  U  frame command.  A received command is not actually 
  622. processed until the UA response frame is sent.  An information  field is 
  623. not permitted in a UA frame.
  624.                             
  625.  
  626.      Frame_Reject_(FRMR)_Response
  627.  
  628. The  FRMR  response  frame  is  sent  to report that for some reason the 
  629. receiver of a command or information frame cannot  successfully  process 
  630. that  frame  and  that the error condition is not correctable by sending 
  631. the offending frame again.  Typically this condition will appear  when a 
  632. frame  without  an FCS error has been received with one of the following 
  633. conditions:
  634.  
  635.         1.  The reception of an invalid or not implemented        
  636.         command or response frame.
  637.  
  638.         2. The reception of an I frame  whose  information 
  639.         field exceeds the agreed upon length.
  640.  
  641.         3. The reception of an improper N(R). This usually 
  642.         happens when the N(R) frame has already been  sent 
  643.         and  acknowldeged, or when N(R) is out of sequence 
  644.         with what was expected.
  645.  
  646.         4. The reception of a frame  with  an  information 
  647.         field  where  one is not allowed, or the reception 
  648.         of an U or S frame whose length is incorrect.
  649.  
  650. When a CMDR or FRMR frame is sent, an information field is added to  the 
  651. frame that helps to explain where the problem occurred. This information 
  652. field is three octets long and its contents is shown if Fig. 9 below.
  653.  
  654. --------------------------------------------------
  655. |             Information Field Bits             |
  656. | 2 2 2 2 1 1 1 1 1 1 1 1 1 1                    |
  657. | 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0|
  658. |------------------------------------------------|
  659. | 0 0 0 0|Z|Y|X|W| V(R)|C| V(S)|0| Rejected Frame|
  660. |        | | | | |     | |     | | Control Field |
  661. --------------------------------------------------
  662.      Fig. 9.  FRMR Frame Information Field
  663.  
  664.         Where:
  665.  
  666.         1. The rejected frame control  field  carries  the 
  667.         control  field of the frame that caused the reject 
  668.         condition.  It is in bits 1-8  of  the information 
  669.         field.
  670.  
  671.         2.  V(S) is the current send state variable of the 
  672.         device reporting the rejection (bit 10 is the  low 
  673.         bit).
  674.  
  675.         3.  V(R)  is the current receive state variable of 
  676.         the device reporting rejection (bit 14 is the  low 
  677.         bit).
  678.  
  679.         4.  If  W  is set to 1, the control field received 
  680.         was invalid or not implemented.
  681.  
  682.         5. If X is set to 1, the  frame  that  caused  the 
  683.         reject condition was considered invalid because it 
  684.         was a U or S frame that had an  information  field 
  685.         that  is  not  allowed.  Bit W must be set to 1 in 
  686.         addition to the X bit.
  687.  
  688.         6. If Y is set to 1, the  information  field  of a 
  689.         received  frame  exceeded  the maximum capacity of 
  690.         the device reporting the condition.
  691.  
  692.         7. If Z is set to 1, the  control  field  received 
  693.         and  returned  in bits 1 to 8 contained an invalid 
  694.         N(R).
  695.  
  696.         8. Bits 8, and 20 to 23 are set to 0.   Bit  12 is 
  697.         set to 0 if the rejected frame was a command, or 1 
  698.         if if it was a response.
  699.                                                                      
  700.         Unnumbered_Information_(UI)_Frame
  701.  
  702. The  unnumbered  information frame is used to pass information along the 
  703. link outside the normal information controls.   This  allows information 
  704. fields  to  go back and forth on the link bypassing flow control.  Since 
  705. these frames are NOT acknowledgeable, if one gets wiped out, there is no 
  706. way to recover it.
  707.                                                                       
  708. The UI frame is not defined in X.25.  It has been  taken  from  ADCCP to 
  709. allow uncontrolled information to flow thru the link without interfering 
  710. with a next higher layer.
  711.  
  712.  
  713. Link_Error_Recovery
  714.  
  715. There are several link-level errors that are recoverable without tearing 
  716. down  the  connection.   These error situations may occur as a result of 
  717. malfunctions within the DTE or DCE, or if transmission errors occur.
  718.                                                                     
  719.  
  720.      Invalid_Frame_or_FCS_Error
  721.  
  722. If an invalid frame is received, or a frame  is  received  with  an  FCS 
  723. error, that frame will be discarded with no action taken.
  724.                                                          
  725.  
  726.      Device_Busy_Condition
  727.  
  728. When a DTE or DCE becomes temporarily busy, such as when receive buffers 
  729. are full, it will send a receive not ready (RNR) frame.  This  tells the 
  730. other  side  of the link that the device cannot handle any more I frames 
  731. at the moment. This condition is usually cleared by the sending of a UA, 
  732. RR, REJ, or SABM command frame.
  733.                                
  734.  
  735.      Send_Sequence_Number_Error
  736.  
  737. If  the send sequence number , N(S), of an otherwise error-free received 
  738. I frame does not match the receive state variable, V(R), a send sequence 
  739. error  has  occured,  and  the information field will be discarded.  The 
  740. receiver will not acknowledge this frame, or any other  I  frames  until 
  741. N(S) matches V(R).
  742.                   
  743. The  control  field of the erroneous I frame(s) will be accepted so that 
  744. link supervisory functions can still be performed, such as checking  the 
  745. P/F bit. Because of this updating, the retransmitted I frame may have an 
  746. updated P bit and N(R).
  747.                        
  748.  
  749.      Reject_(REJ)_Error_Recovery
  750.  
  751. REJ is used to request  a  retransmission  of  I  frames  following  the 
  752. detection of a sequence error.  Only one outstanding reject condition is 
  753. allowed at a time.  This condition is cleared when the requested I frame 
  754. has been received.
  755.  
  756. A  device receiving the REJ command will clear the error by sending over 
  757. the I frame indicated in N(R) of of the REJ command frame.
  758.                                                           
  759.      Time-out_Error_Recovery
  760.  
  761. When a transmission abnormality wipes out a single I frame, or the  last 
  762. I  frame  of a group, there is no way of telling this immediately, since 
  763. the receiver does not necessarily know something was sent until  another 
  764. frame  is sent resulting in an out-of-sequence error.  To cope with this 
  765. situation better some form of time-out delay will be incorporated by the 
  766. sender after it sends out a frame. This time-out timer is started at the 
  767. time a frame is sent, and stopped by the reception of an acknowledgement 
  768. for the sent frame.  If the timer times out before an acknowledgement is 
  769. received, any unacknowledged frames are retransmitted.  The delay  is an 
  770. agreed-upon  amount  that  will  vary  with  the  type  of rf medium and 
  771. signaling speed used.
  772.                      
  773.  
  774.      Rejection_Error
  775.  
  776. A rejection error condition occurs when an error-free received frame has 
  777. one of the following problems:
  778.  
  779.         1. An invalid command or response control field.
  780.  
  781.         2. An invalid frame format.
  782.  
  783.         3. An Invalid N(R).
  784.  
  785.         4. An information field that exceeds  the  maximum 
  786.         the device can accept.
  787.  
  788. Once  a  rejection error occurs, no more I frames are accepted (with the 
  789. exception of the P/F bit still usable) until the error is resolved.  The 
  790. error  condition  is reported to the other side of the link by sending a 
  791. FRMR response frame.
  792.                     
  793.                                                  
  794.  
  795. Primary/Secondary_versus_Balanced_Operation
  796.  
  797. There are two basic classes of link-level connections.  The first, known 
  798. as  Link Access Procedure (or LAP) is often called an unbalanced service 
  799. where the DCE is considered the primary (or master) devices and the DTEs 
  800. are considered secondary (or slave) devices. The second class of service 
  801. is known as LAPB, Link Access Procedure Balanced.  In this  service both 
  802. devices  are  treated  as equals as far as connection requests and other 
  803. types of commands.  There is still only  one  DCE  and  potentially many 
  804. DTEs, but both ends can command the link equally.
  805.  
  806.  
  807.      Primary/Secondary_(LAP)_Operation
  808.  
  809. LAP  is  the older style of link control, where most of the intelligence 
  810. was assumed to be in a large mainframe (the DCE) and the end users  were 
  811. just using smart terminals (the DTEs). Since network software can have a 
  812. lot of overhead, it made sense at the time to put most of  the  overhead 
  813. in the big computer, and just enough smarts to make the link work in the 
  814. terminals.
  815.           
  816.      Balanced_(LAPB)_Operation
  817.  
  818. LAPB is a slightly modified version of LAP. It has been changed to allow 
  819. the  two  sides  of a link to operate in a more balanced manner.  In the 
  820. official version of X.25 there is still only one DCE to potentially many 
  821. DTEs, but the two can operate more as equals than master and slave.
  822.  
  823. LAPB  is  what this document describes for use over Amateur Radio packet 
  824. networks. Even when there is a network controller overseeing the network 
  825. operation, the balanced link procedure will enhance operation.
  826.                                                               
  827.  
  828.  
  829. Connection_Operation
  830.  
  831. In  amateur  radio  network  operations, it would be very helpful if one 
  832. level 2 protocol would work with the various  rf  systems  in  use.   An 
  833. example  of  this  is  the  difference  in  operation  between  a simple 
  834. two-station  link,  and  multiple  stations  operating  thru  a  network 
  835. controller.    Obviously, when a network controller exists, it should be 
  836. considered the DCE, while the other stations connecting to it  would  be 
  837. the  DTEs.   A simple two-station connection is another matter.  To this 
  838. type of connection the station requesting a connection should always  be 
  839. considered  the  DTE,  while the device that is receiving the connection 
  840. request should operate as the DCE. This simple rule should eliminate any 
  841. ambiguity that might otherwise occur under these conditions.
  842.  
  843. NOTE:  There  are a couple minor changes from the official X.25 standard 
  844. in the protocol recommended  here.    These  changes  are  done  only as 
  845. absolutely  necessary  to work over the shared rf media.  Since X.25 was 
  846. written to work so that one DCE talked with  many  DTEs  over  a  closed 
  847. network,  it cannot properly cope with a channel where there may be many 
  848. DCEs linked to many DTEs.  Some amateurs have thrown X.25 out because of 
  849. this  problem.    It  seems  to  take just a couple minor changes in the 
  850. initial link set-up procedure to make X.25 work  properly  over  amateur 
  851. radio.    Where these changes are made, both the original X.25 procedure 
  852. and the recommended amateur procedure will be noted.
  853.                                                     
  854.  
  855.  
  856. LAPB_Procedures
  857.  
  858. The  following  describes  the  procedures  used  to  set-up,  use,  and 
  859. disconnect a balanced link between a DTE and DCE.  These procedures have 
  860. been taken from X.25 and conform very closely to that  standard,  except 
  861. where it was necessary to change due to the radio environment.
  862.                                                               
  863.  
  864.      Address_Field_Operation
  865.  
  866. All  transmitted  frames  shall  have address fields conforming to above 
  867. mentioned rules.  All frames should have both the destination device and 
  868. the  source  device addresses in the address field, with the destination 
  869. address coming first.  This will allow many links to share  the  same rf 
  870. channel. The destination address is always the address of the station(s) 
  871. to receive the frame, while the source address contains the  address  of 
  872. the  device that sent the frame.  The destination address can be a group 
  873. name or club call however, if point to multi-point operation is allowed. 
  874. This will be discussed further under link operations.
  875.                                                      
  876.  
  877.      LAPB_Connection_Establishment
  878.  
  879. When a device (either a DCE or DTE) wishes to connect to another device, 
  880. it will send a SABM command frame to that device and  start  a  time-out 
  881. timer  (T1).   If the other device is there and able to connect, it will 
  882. answer with a UA response frame and at the same time reset both of  it's 
  883. internal  state  variables  (V(S)  and  V(R)).   The reception of the UA 
  884. response frame at the other end will cause  the  device  requesting  the 
  885. Nconnection  to  abort the T1 timer and set its internal state variables 
  886. to 0 also.
  887.  
  888. If the other device doesn't respond before  T1  times  out,  the  device 
  889. requesting  the  connection  will  re-send  the SABM frame, and start T1 
  890. running again. This trying to establish a connection will continue until 
  891. the  requesting device has tried unsuccessfully a number of times.  That 
  892. number (N1) is variable depending on the frequency of operation, type of 
  893. transmission (eg.  terrestial vs.  satellite), and the signaling speed n 
  894. use. N1 will be discussed in another section.
  895.                                              
  896.  
  897.      Information_Transfer
  898.  
  899. Once a connection has been established as outlined above,  both  devices 
  900. are able to accept I, S, and U frames.
  901.                                       
  902.  
  903.      Sending_of_I_Frames
  904.  
  905. Whenever  a station has an I frame to transmit, it will send the I frame 
  906. with N(S) of  Nth  control  field  equal  to  it's  current  send  state 
  907. variable  V(S).    Once  the I frame is sent, the send state variable is 
  908. incremented by one.
  909.  
  910. The station should not transmit any more I frames  if  it's  send  state 
  911. variable  equals  the  ast received N(R) from the other side of the link 
  912. plus seven.  If it were to send more I frames, the  flow  control window 
  913. would be exceeded and errors could result.
  914.  
  915. If  a  device is in a busy condition, it may still send I frames as long 
  916. as the other device is not also busy.
  917.  
  918. If a device is in the  frame-rejection  mode,  it  will  stop  sending I 
  919. frames.
  920.        
  921.  
  922.      Receiving_I_Frames
  923.  
  924. If  a  device receives a valid I frame (one with a correct FCS and whose 
  925. send sequence number equals the receiver's receive state  variable)  and 
  926. is  not  in  the  busy  condition,  it will accept the received I frame, 
  927. increment it's receive state variable, and act in one of  the  following 
  928. manner:
  929.  
  930.         1.  If it has an I frame to send, that I frame may 
  931.         be sent with the transmitted N(R)  equal  to  it's 
  932.         receive  state  variable  V(R) (thus acknowledging 
  933.         the received frame.  Alternately,  the  device may 
  934.         send an RR frame with N(R) equal to V(R), and then 
  935.         send the I frame.
  936.  
  937.         2.  If  there  are  no  outstanding  I  frames,the 
  938.         receiving  device  will send an RR frame with N(R) 
  939.         equal to V(R).
  940.  
  941. If  the  device  is  in  a  busy condition, it may ignore any received I 
  942. frames  without  reporting  this  condition  other  than  repeating  the 
  943. indication of the busy condition.
  944.  
  945. If  a  busy  condition  exists, the station receiving the busy condition 
  946. indication should poll the sender of the  busy  indication  periodically 
  947. until the busy condition disappears.
  948.  
  949. The  reception  of  I frames that contain zero length information fields 
  950. shall be reported to the next level but no  information  field  will  be 
  951. transferred.
  952.  
  953. When  an  I frame is received with a correct FCS, but it's send sequence 
  954. number does not match the current receiver's receive state variable, the 
  955. frame  should be discarded and a REJ frame should be sent with a receive 
  956. sequence number equal to one higher (modulo 8) than the  last  correctly 
  957. received  I  frame  .    Any out-of-sequence received I frames should be 
  958. handled in this manner. The received state variable and poll bit in such 
  959. a  discarded  frame  should be checked before throwing it away, and take 
  960. any action needed depending on the condition of them.
  961.                                                      
  962.      Receiving_Acknowledgement
  963.                                                       
  964. Whenever an I  or  S  frame  is  correctly  received,  even  in  a  busy 
  965. condition, the N(R) of the received frame should be checked to see if it 
  966. includes an acknowldegment of outstanding sent I frames.   The  T1 timer 
  967. should  be  reset if the received frame actually acknowledges previously 
  968. unacknowledged frames.  If the T1 timer is reset,  and  there  are still 
  969. some  frames that have been sent that are not acknowledged, T1 should be 
  970. started again.  If the T1 timer runs out  before  an  acknowledgement is 
  971. received, the device should proceed to the retransmission procedure.
  972.                                                                     
  973.  
  974.      Receiving_Reject
  975.  
  976. Upon  receiving  a REJ frame, the transmitting station will set its send 
  977. state variable to the same value are the REJ  frames  received  sequence 
  978. number  in  the  control  field.   The device will then retransmit any I 
  979. frame(s) outstanding at the next available opportunity conforming to the 
  980. following:
  981.  
  982.         1. If the device is not transmitting at the  time, 
  983.         and  the  channel is open, the device may commence 
  984.         to retransmit the I frame(s) immediately.
  985.  
  986.         2. If the device is operating  on  a  full  duplex 
  987.         channel  transmittiong  a  U  or  S  frame when it 
  988.         receives a REJ frame, it may finish finding  the U 
  989.         or S frame and then retransmit the I frame(s).
  990.  
  991.         3.  If  the  device  is operating in a full duplex 
  992.         channel  transmitting  another  I  frame  when  it 
  993.         receives  a REJ frame, it may abort the I frame it 
  994.         was  sending  and  start  retransmission  of   the 
  995.         requested I frames immediately.
  996.  
  997.         4.  The  device  may  send  just  the  one I frame 
  998.         outstanding, or it may send more than one  if  any 
  999.         more   I   frames   followed  the  first  one  not 
  1000.         acknowledged, provided the total to be  sent  does 
  1001.         not exceed the flow control window (7 frames).
  1002.  
  1003. If  the  device  receives  a  REJ frame with the poll bit set, it should 
  1004. respond with either an RR or RNR frame with the  final  bit  set  before 
  1005. retransmitting the outstanding I frame(s).            
  1006.                                           
  1007.  
  1008.      Receiving_an_RNR_Frame
  1009.  
  1010. Whenever  a  device receives an RNR frame, it may transmit or retransmit 
  1011. the I frame whose send sequence  number  equals  that  of  the  received 
  1012. sequence number indicated in the RNR control field. If timer T1 runs out 
  1013. after the RNR was received, the waiting acknowledgement procedure listed 
  1014. below should be performed.  The poll bit may be used in conjunction with 
  1015. S frames to test for a  change  in  the  condition  of  the  busied  out 
  1016. station.  No I frames other than the one mentioned above may be sent out 
  1017. before the busy condition is cleared.
  1018.  
  1019.      Sending_a_Busy_Indication
  1020.  
  1021. Whenever a device enters a busy condition,  it  will  indicate  this  by 
  1022. sending an RNR response at the next opportunity.  While the device is in 
  1023. the busy condition, it may  receive  and  process  S  frames,  and  if a 
  1024. received  S frame has the P bit set to one, the device should send a RNR 
  1025. frame with the F bit set to one at the next  possible  opportunity.   To 
  1026. clear  the  busy  condition,  the  device should send either a RR or REJ 
  1027. frame with the received sequence number equal  to  the  current  receive 
  1028. state  variable,  depending  on  whether  the  last received I frame was 
  1029. properly received or not.
  1030.                          
  1031.  
  1032.      Waiting_Acknowledgement
  1033.  
  1034. The device should maintain an  internal  retransmission  count  variable 
  1035. which  is  set  to zero whenever another I frame is acknowledged (either 
  1036. thru the reception of a UA or RNR frame, or when a received I or S frame 
  1037. has   an   N(R)   higher  than  the  last  received  N(R),  showing  the 
  1038. acknowledgement of additional I frames).
  1039.  
  1040. Any time the timer T1 runs out,  the  device  will  re-enter  the  timer 
  1041. recovery   condition,   the   retransmission   count  variable  will  be 
  1042. incremented by one, and another internal variable (X) will be set to the 
  1043. current send state variable value.
  1044.  
  1045. The  device  will  then  restart  the  T1  timer,  set its receive state 
  1046. variable to  the  last  receive  sequence  number,  and  retransmit  the 
  1047. corresponding I or S frame with the P bit set to one.
  1048.  
  1049. The timer recovery condition is cleared when the device receives a valid 
  1050. S frame with the F bit set to one.
  1051.  
  1052. If the device receives an S frame with the F bit set  to  one  and  N(R) 
  1053. within  the  range  from  the current send state variable to X mentioned 
  1054. above inclusive while in the timer recovery  condition,  this  condition 
  1055. will  be  cleared,  and  the send state variable will be set to the N(R) 
  1056. received.
  1057.  
  1058. If the device receives an S frame  with  the  F  bit  set  to  zero  but 
  1059. otherwise  the  same condition as the last paragraph, the timer recovery 
  1060. condition will NOT be cleared.  The received N(R) may be used however to 
  1061. update  the  send  state variable.  The device may keep the last I frame 
  1062. transmitted (even if it was acknowledged) to be retransmitted with the P 
  1063. bit set to one if timer T1 expires at a later time.
  1064.  
  1065. Once  the  retransmission  count  variable reaches N2, the device should 
  1066. proceed to the resetting procedures outlined below.
  1067.                                                    
  1068.  
  1069.      Link_Disconnection
  1070.  
  1071. When in the information-transfer phase,  either  device  may  initiate a 
  1072. link disconnection by sending a DISC frame.  It should then start its T1 
  1073. timer, and wait for a response.  If  the  proper  response  doesn't come 
  1074. before T1 times out, it should send the DISC frame again and restart T1. 
  1075. If this happens N2 times,  the  device  should  enter  the  disconnected 
  1076. state.
  1077.  
  1078. When  a DISC frame is received, the receiver should return a UA response 
  1079. frame, and enter the disconnected state.
  1080.  
  1081.      Disconnected_State
  1082.                                         
  1083. After having sent a DISC frame and received a UA, or  receiving  a  DISC 
  1084. and having sent a UA, the device will enter the disconnected state.
  1085.  
  1086. In  the  disconnected  state,  the  device may initiate a link set-up as 
  1087. outlined in connection establishment above.  It may also respond  to the 
  1088. reception  of  a  SABM  and establish a connection, or it may ignore the 
  1089. SABM and send a DM instead.
  1090.  
  1091. Any station receiving a DISC command while  in  the  disconnected  state 
  1092. should send back a DM response frame.
  1093.  
  1094. Any  device receiving a command frame other than a SABM or UI frame with 
  1095. the P bit set to one should respond with a DM frame with the F  bit  set 
  1096. to one. The offending frame should also be ignored.
  1097.  
  1098. When  the  device enters the disconnected state after an error condition 
  1099. or if it has recovered from an internal error condition by coming up  in 
  1100. the disconnected state, it should indicate this by sending a DM response 
  1101. rather than a DISC frame.  It should start the T1 timer when  the  DM is 
  1102. sent,  and  if T1 times out before getting a SABM or DISC frame back, it 
  1103. should send another DM frame, and restart T1.  After  retransmitting the 
  1104. DM frame N2 times, the device will remain in the disconnected state, and 
  1105. no other action will be taken.
  1106.                               
  1107.  
  1108.      Resetting_Procedure
  1109.  
  1110. The resetting procedure is used to initialize both  directions  of  flow 
  1111. after  a  nonecoverable  error has occured.  This resetting procedure is 
  1112. only used when in the information transfer phase of an AX.25 link.
  1113.  
  1114. A device shall request a reset by sending an SABM frame.  Upon receiving 
  1115. an SABM frame from a station previously connected to, the receiver of an 
  1116. SABM frame should send a UA frame back at the earliest opportunity. Both 
  1117. devices  should then set their send and receive state variables to zero. 
  1118. Any busy condition that previously existed will also be cleared.
  1119.  
  1120. It is possible to initiate a disconnect procedure instead  of  resetting 
  1121. the link.
  1122.  
  1123. One  device may ask the other to reset the link by sending a DM response 
  1124. frame.  After the DM frame is sent, the sending device  will  then enter 
  1125. the disconnected state.
  1126.  
  1127. One  device may ask the other to initiate a link reset by transmitting a 
  1128. FRMR response frame.
  1129.  
  1130. After sending the FRMR frame, the sending device will  enter  the  frame 
  1131. reject  state.   This condition is cleared when the device that sent the 
  1132. FRMR frame receives an SABM or DISC command, or a DM response frame. Any 
  1133. other  command  received  while  the device is in the frame reject state 
  1134. will cause another FRMR to be sent out with the same  information  field 
  1135. as originally sent.
  1136.  
  1137. The  device  that sent the FRMR frame should start the T1 timer when the 
  1138. FRMR is sent.  If above mentioned frames  are  not  received  before the 
  1139. timer runs out, the FRMR frame should be retransmitted, and the T1 timer 
  1140. restarted as described in the waiting acknowledgement section above.  If 
  1141. the FRMR is sent N2 times without success, the link should be reset.
  1142.                                                                     
  1143.      Rejection_Conditions
  1144.  
  1145. A  device  should  initiate  the  link-reset  procedure  when a frame is 
  1146. received with the correct FCS and address field during  the  information 
  1147. transfer phase with one or more of the following conditions:
  1148.  
  1149.         1. The frame is not known as a command or response 
  1150.         to the device.
  1151.  
  1152.         2. The information field is invalid (as an example 
  1153.         is longer than 256 octets)
  1154.  
  1155.  
  1156. A  device  will  initiate a reset procedure whenever it receives a DM or 
  1157. FRMR response frame during the information transfer phase.
  1158.  
  1159. A device may initiate a reset procedure also whenever it receives  a  UA 
  1160. response  frame or if it receives an unsolicited response frame with the 
  1161. F bit set to one.
  1162.                  
  1163.  
  1164.  
  1165. Collision_Recovery
  1166.  
  1167.  
  1168.      Collisions_in_a_Half-Duplex_Enviroment
  1169.  
  1170. Collisions of frames  of  any  type  in  a  half-duplex  enviroment  are 
  1171. essentially  taken  care  of  by  the  retry  nature of the T1 timer and 
  1172. retransmission count variable.  No  other  special  action  needs  to be 
  1173. taken.
  1174.       
  1175.  
  1176.      Collisions_in_a_Full-Duplex_Enviroment
  1177.  
  1178. Collisions  in a full-duplex enviroment are not really frame collisions, 
  1179. but have more to do with the  devices  being  pulled  in  two  different 
  1180. directions at the same time.
  1181.                             
  1182.  
  1183.      Collisions_of_Unnumbered_Commands
  1184.  
  1185. If  the  sent  and  received U command frames are the same, both devices 
  1186. should send a UA response at the earliest opportunity, and both  devices 
  1187. should enter the indicates state.
  1188.  
  1189. If  the  sent and received U commands are different, both devices should 
  1190. enter the disconnected state, and transmit a DM frame  at  the  earliest 
  1191. opportunity.
  1192.             
  1193.  
  1194.      Collision_of_a_DM_with_a_SABM_or_DISC
  1195.  
  1196. When  an  unsolicited  DM response frame is sent, a collision between it 
  1197. and a SABM or DISC may occur.  In order to prevent  this  DM  from being 
  1198. misinterpreted, all unsolicited DM frames should be transmitted with the 
  1199. F bit set to zero.  All SABM and DISC frames should be sent  with  the P 
  1200. bit  set  to  one,  so  there  isn't  any  confusion  when a DM frame is 
  1201. received.
  1202.          
  1203.  
  1204.  
  1205. Connectionless_Operation
  1206.  
  1207. In Amateur Radio circles, there is a type of operation that isn't really 
  1208. feasable  using  level 2 connections.  This operation is the roundtable, 
  1209. where several amateurs may be engaged in one conversation.  The only way 
  1210. to  accomplish  this  in  a  connected  mode  would  be to have everyone 
  1211. crossconnected with each other.  This would require a seperate  frame to 
  1212. be  sent  to  each  member  of  the  roundtable  every time someone says 
  1213. something.  Obviously, this mode is not practical.  The way most amateur 
  1214. packet  radio  enthusiasts  have  ended  up  implementing the roundtable 
  1215. operation is outside the AX.25 connection, but  still  using  the  AX.25 
  1216. frame  structure.   AX.25 does allow a special frame for this operation, 
  1217. called the Unnumbered Information (UI) frame.   It  is  recommended that 
  1218. when  this  type  of operation is in use, the destination address have a 
  1219. code word installed in it  to  prevent  the  users  of  that  particular 
  1220. roundtable  from  seeing all frames going thru the shared RF medium.  An 
  1221. example of this is if a group of amateurs are in a roundtable discussion 
  1222. about packet radio, they could put PACKET in the destination address, so 
  1223. they would only receive frames from others in the same  discussion.   An 
  1224. added advantage of the use of AX.25 in this manner is that the source of 
  1225. each frame is in the source address sub-field, so re could be written to 
  1226. automatically display who is making what comments.
  1227.  
  1228. Admittedly, this is a kludge to the level 2 AX.25 protocol. This type of 
  1229. operation really belongs at the next layer (layer 3,  packet  level)  of 
  1230. operation  but  until  layer  3  is  implemented,  this appears to be an 
  1231. acceptable substitute.
  1232.  
  1233. Keep in mind that this mode is connectionless, so all transmitted frames 
  1234. should   be   of  good  quality,  as  there  will  be  no  requests  for 
  1235. retransmissions of bad frames.  Collisions  will  also  occur,  with the 
  1236. potential of losing the frames that collided.
  1237.                                              
  1238.  
  1239.  
  1240. List_of_System_Defined_Parameters
  1241.  
  1242.  
  1243.      Timers
  1244.  
  1245. It  is  recommended  that  there  are  two  timers  used to maintain the 
  1246. integrity of the AX.25 layer 2 connection.
  1247.  
  1248. The first timer, T1, is used to make sure a device doesn't wait  forever 
  1249. for  a  response to a frame it sends.  This timer cannot be expressed in 
  1250. absolute time, since the time required to  send  frames  varies  greatly 
  1251. with the baud rate used at level 1. T1 should be at least twice the time 
  1252. it would take to send a maximum length frame to the  other  end  of  the 
  1253. link,  and  get the proper response frame back from the other end of the 
  1254. link.  This would allow time for the other end of the  link  to  do some 
  1255. processing before responding.
  1256.  
  1257. The  second  timer,  T2,  is used whenever T1 isn't running to make sure 
  1258. that  a  supervisory  frame  is  sent  periodically  to  maintain   link 
  1259. integrity.   It  also  will  vary  dramatically  depending  on  layer 1 
  1260. constraints, and is subject for further study.
  1261.                                               
  1262.  
  1263.      Maximum_Number_of_Retrys_(N2)
  1264.  
  1265. The maximum number of retrys is used in conjunction with the  T1  timer. 
  1266. It  will  vary  depending  on  the layer 1 in use, but will generally be 
  1267. sixteen.
  1268.         
  1269.  
  1270.      Maximum_Number_of_Octets_in_an_I_Field_(N1)
  1271.  
  1272. The maximum number of octets allowed in the I field will be 256.   There 
  1273. should also be an even multiple number of octets.
  1274.                                                  
  1275.  
  1276.      Maximum_Number_of_I_Frames_Outstanding_(k)
  1277.  
  1278. The maximum number of outstanding I frames at a time is seven. A smaller 
  1279. number may be used at any time, provided it  is  agreed  upon  ahead  of 
  1280. time.
  1281.  
  1282.  
  1283.       First
  1284.       Bit Sent
  1285.       -----------------------------------------------------------
  1286.       |   Flag   |  Address   | Control |    FCS     |  Flag    |
  1287.       |---------------------------------------------------------|
  1288.       | 01111110 |112/168 Bits| 8  Bits |  16  Bits  | 01111110 |
  1289.       -----------------------------------------------------------
  1290.                  Figure 1A.  U and S Frame Construction
  1291.  
  1292.  
  1293.  
  1294. First
  1295. Bit Sent
  1296. ------------------------------------------------------------------------
  1297. |   Flag   |  Address   | Control|  PID  | Info.   |  FCS   |  Flag    |
  1298. ------------------------------------------------------------------------
  1299. | 01111110 |112/168 Bits| 8 Bits | 8 Bits| N*8 Bits| 16 Bits| 01111110 |
  1300. ------------------------------------------------------------------------
  1301.                Figure 1B.  Information Frame Construction
  1302.  
  1303.  
  1304.  
  1305.            First
  1306.            Octet Sent
  1307.            --------------------------------------------------
  1308.            |             Address Field of Frame             |
  1309.            |------------------------------------------------|
  1310.            | Destination Address |     Source Address       |
  1311.            |------------------------------------------------|
  1312.            |A1 A2 A3 A4 A5 A6 A7 | A8 A9 A10 A11 A12 A13 A14|
  1313.            --------------------------------------------------
  1314.             Figure 2A.  Non-Repeater Address Field Encoding
  1315.  
  1316.  
  1317.  
  1318.  
  1319. First
  1320. Octet Sent
  1321. ----------------------------------------------------------------------------
  1322. |                       Address Field of Frame                             |
  1323. |---------------------------------------------------------------------------
  1324. | Destination Address|     Source Address      |    Repeater  Address      |
  1325. |--------------------------------------------------------------------------|
  1326. |A1 A2 A3 A4 A5 A6 A7|A8 A9 A10 A11 A12 A13 A14|A15 A16 A17 A18 A19 A20 A21|
  1327. ----------------------------------------------------------------------------
  1328.                 Figure 2B.  Repeater Address Field Encoding
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.                 Appendix A.  Non-Repeater Frame Example
  1341.  
  1342.        -----------------------------------
  1343.        | Octet | ASCII |Bin.Data|Hex Data|
  1344.        -----------------------------------
  1345.        | Flag  |       |01111110|   7E   |
  1346.        |  A1   |   K   |10010110|   96   |
  1347.        |  A2   |   8   |01110000|   70   |
  1348.        |  A3   |   M   |10011010|   9A   |
  1349.        |  A4   |   M   |10011010|   9A   |
  1350.        |  A5   |   O   |10011110|   9E   |
  1351.        |  A6   | space |01000000|   40   |
  1352.        |  A7   | SSID  |01100000|   60   |
  1353.        |  A8   |   W   |10101110|   AE   |
  1354.        |  A9   |   B   |10000100|   84   |
  1355.        |  A10  |   4   |01101000|   68   |
  1356.        |  A11  |   J   |10010100|   94   |
  1357.        |  A12  |   F   |10001100|   8C   |
  1358.        |  A13  |   I   |10010010|   92   |
  1359.        |  A14  | SSID  |01100001|   61   |
  1360.        |Control| SABM  |00111111|   3F   |
  1361.        |  PID  | none  |11110000|   F0   |
  1362.        |  FCS  | part 1|XXXXXXXX|   HH   |
  1363.        |  FCS  | part 2|XXXXXXXX|   HH   |
  1364.        | Flag  |       |01111110|   7E   |
  1365.        -----------------------------------
  1366.  
  1367. The  frame  shown  is  an SABM frame, not going thru a level 2 repeater, 
  1368. from WB4JFI (SSID=0) to K8MMO (SSID=0), with no level 3 protocol.
  1369.  
  1370.  
  1371.                Appendix B.  Repeater Type Operation
  1372.  
  1373.        | Octet | ASCII |Bin.Data|Hex Data|
  1374.        |---------------------------------|
  1375.        | Flag  |       |01111110|   7E   |
  1376.        |  A1   |   K   |10010110|   96   |
  1377.        |  A2   |   8   |01110000|   70   |
  1378.        |  A3   |   M   |10011010|   9A   |
  1379.        |  A4   |   M   |10011010|   9A   |
  1380.        |  A5   |   O   |10011110|   9E   |
  1381.        |  A6   | space |01000000|   40   |
  1382.        |  A7   | SSID  |01100000|   60   |
  1383.        |  A8   |   W   |10101110|   AE   |
  1384.        |  A9   |   B   |10000100|   84   |
  1385.        |  A10  |   4   |01101000|   68   |
  1386.        |  A11  |   J   |10010100|   94   |
  1387.        |  A12  |   F   |10001100|   8C   |
  1388.        |  A13  |   I   |10010010|   92   |
  1389.        |  A14  | SSID  |01100000|   60   |
  1390.        |  A15  |   W   |10101110|   AE   |
  1391.        |  A16  |   B   |10000100|   84   |
  1392.        |  A17  |   4   |01101000|   68   |
  1393.        |  A18  |   J   |10010100|   94   |
  1394.        |  A19  |   F   |10001100|   8C   |
  1395.        |  A20  |   I   |10010010|   92   |
  1396.        |  A21  | SSID  |11100011|   E3   |
  1397.        |Control| SABM  |00111111|   3F   |
  1398.        |  PID  | none  |11110000|   F0   |
  1399.        |  FCS  | part 1|XXXXXXXX|   HH   |
  1400.        |  FCS  | part 2|XXXXXXXX|   HH   |
  1401.        | Flag  |       |01111110|   7E   |
  1402.        -----------------------------------
  1403.  
  1404. The above frame is the same as in Appendix A, but with the addition of a 
  1405. repeater address subfield (WB4JFI, SSID=1). The H bit is set, indicating 
  1406. this is from the output of the repeater.
  1407.  
  1408.  
  1409.  
  1410.                    Appendix C.          
  1411.  
  1412.     Advantages of the WB4JFI Addressing Scheme
  1413.                                                            
  1414.  
  1415.  
  1416. Some of the advantages to using this addressing system are:
  1417.  
  1418.         1.  Every  packet station will have a unique fixed 
  1419.         address that  doesn't  change  every  time  a  new 
  1420.         network is logged into.
  1421.  
  1422.         2.  Relocating to a new area won't cause major (or 
  1423.         minor) problems.
  1424.  
  1425.         3. Allows for more than 62 or 31 users at a time.
  1426.  
  1427.         4. No  local  packet  guru  is  needed  to  assign 
  1428.         addresses  with  attendant  concerns of backup and 
  1429.         transfer during failure.
  1430.  
  1431.         5. Direct or network operation requires no  change 
  1432.         of address.
  1433.  
  1434.         6.     All     the     problems    with    dynamic 
  1435.         allocation/de-allocation are eliminated.
  1436.  
  1437.         7. Reduces local co-network  interference  due  to 
  1438.         users in overlapping local network rf domains with 
  1439.         the same address fields.
  1440.  
  1441.         8. With every frame having  both  the  destination 
  1442.         and  source  addresses  in  them, it will be a lot 
  1443.         easier to set-up and run multiple  connections  on 
  1444.         the  same  data  channel  without  having problems 
  1445.         arise as to who is sending what frames to whom.
  1446.  
  1447.         9. In round-table operation, every frame sent will 
  1448.         have  the  source address imbedded in it, allowing 
  1449.         automatic printing of the source of the frame.
  1450.  
  1451.     
  1452.     
  1453.                                  Appendix D.  Layer 2 AX.25 State Table
  1454.  
  1455. -----------------------------------------------------------------------------------------------------------------------------------
  1456. |    State          |I with|I with-|RR with|RR with-|REJ with|REJ with-|RNR with|RNR with-| SABM | DISC |  UA   |   DM   |  FRMR  |
  1457. |                   | Poll |out  P | Final |out  F  | Final  |out  F   | Final  |out  F   |either|either| either| either | either |
  1458. |---------------------------------------------------------------------------------------------------------------------------------|
  1459. |S1 Disconnected    |  DM  |       |  DM   |        |   DM   |         |   DM   |         |UA,S5 | DM   |       |SABM,S2 |        |
  1460. |---------------------------------------------------------------------------------------------------------------------------------|
  1461. |S2 Link Setup      |      |       |       |        |        |         |        |         |  UA  |DM,S1 |   S5  |   S1   |        |
  1462. |---------------------------------------------------------------------------------------------------------------------------------|
  1463. |S3 Frame Reject    | FRMR |       | FRMR  |        |  FRMR  |         |  FRMR  |         |UA,S5 |UA,S1 |       |SABM,S2 | SABM,S2|
  1464. |---------------------------------------------------------------------------------------------------------------------------------|
  1465. |S4 Disconnect Rqst |      |       |       |        |        |         |        |         |  DM  |  UA  |   S1  |   S1   |        |
  1466. |---------------------------------------------------------------------------------------------------------------------------------|
  1467. |S5 Information Xfr |  RR  |   I   |   I   |   I    |   I    |    I    |   S9   |   S9    |  UA  |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1468. |---------------------------------------------------------------------------------------------------------------------------------|
  1469. |S6 REJ Frame Sent  | RR,S5|  I,S5 |   I   |   I    |   I    |    I    |   S15  |   S15   |UA,S5 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1470. |---------------------------------------------------------------------------------------------------------------------------------|
  1471. |S7 Waiting Acknow. |  RR  |   I   |  I,S5 |   I    |  I,S5  |    I    |   S9   |   S12   |UA,S5 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1472. |---------------------------------------------------------------------------------------------------------------------------------|
  1473. |S8 Device Busy     | RNR  |  RNR  |   I   |   I    |   I    |    I    |   S10  |   S10   |  UA  |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1474. |---------------------------------------------------------------------------------------------------------------------------------|
  1475. |S9 Remote Device   |  RR  |  RR   |  I,S5 |  I,S5  |  I,S5  |  I,S5   |        |         |UA,S5 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1476. |     Busy          |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1477. |---------------------------------------------------------------------------------------------------------------------------------|
  1478. |S10 Both Devices   | RNR  |  RNR  |  I,S8 |  I,S8  |  I,S8  |  I,S8   |        |         |UA,S8 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1479. |     Busy          |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1480. |---------------------------------------------------------------------------------------------------------------------------------|
  1481. |S11 Waiting Acknow.| RNR  |  RNR  |  I,S8 |   I    |  I,S8  |    I    |   S10  |   S13   |UA,S8 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1482. | and Device Busy   |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1483. |---------------------------------------------------------------------------------------------------------------------------------|
  1484. |S12 Waiting Acknow.|  RR  |   RR  |  I,S5 |  I,S7  |  I,S5  |   I,S7  |        |         |UA,S5 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1485. | and Remote Busy   |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1486. |---------------------------------------------------------------------------------------------------------------------------------|
  1487. |S13 Waiting Acknow.| RNR  |  RNR  |  I,S8 |  I,S11 |  I,S8  |  I,S11  |        |         |UA,S8 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1488. | Both Devices Busy |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1489. |---------------------------------------------------------------------------------------------------------------------------------|
  1490. |S14 REJ Sent and   | RNR  |  RNR  |   I   |   I    |   I    |    I    |   S16  |   S16   |UA,S8 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1491. | and Device Busy   |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1492. |---------------------------------------------------------------------------------------------------------------------------------|
  1493. |S15 REJ Sent and   |RR,S9 | RR,S9 |  I,S6 |  I,S6  |   I,S6 |   I,S6  |        |         |UA,S5 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1494. | Remote Busy       |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1495. |---------------------------------------------------------------------------------------------------------------------------------|
  1496. |S16 REJ Sent and   | RNR  |  RNR  | I,S14 |  I,S14 |  I,S14 |  I,S14  |        |         |UA,S5 |UA,S1 |SABM,S2|SABM,S2 | SABM,S2|
  1497. | Both Devices Busy |      |       |       |        |        |         |        |         |      |      |       |        |        |
  1498. -----------------------------------------------------------------------------------------------------------------------------------
  1499.  
  1500.     
  1501. 
  1502.